import React,{Component} from 'react';
import ReactDom from 'react-dom';
import Picker from '@/components/picker/index.jsx'
import InlinePicker from '@/Components/inlinepicker';

class Index extends Component{
    constructor(props){
        super(props);
        this.state={
            itemArr:[
                {
                    value:1,
                    label:'第一个'
                },
                {
                    value:2,
                    label:'第er个'
                },
                {
                    value:3,
                    label:'第san个'
                }
            ],
            itemShow:false,
            myvalue:''
        }
    }

    pickerChange(val){
        console.log(val)
    }

    render(){
        console.log(this.state.itemArr)
        return (
            <div>
                <div onClick={()=>{this.setState({itemShow:true})}}>就当这是个文本框吧-{this.state.myvalue}</div>
                <Picker 
                    show={this.state.itemShow} 
                    groups={this.state.itemArr} 
                    onChange={(val)=>{
                        this.setState({
                            myvalue:val,itemShow:false
                        })
                    }}
                    onHide={()=>{
                        this.setState({
                            itemShow:false
                        })
                    }}
                />
                <InlinePicker groups={this.state.itemArr} onChange={(a,b)=>{console.log(a,b)}}/>
            </div>
        )
    }
}

ReactDom.render(<Index />,document.getElementById("app"));